package com.heihei.demo04;

import javafx.application.Application;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

/**
 *  设置模态
 *
 * @version 1.0
 * @since JDK1.8
 * @author duanhengfei
 * @date 2021年03月11日 17:37:50
 */
public class MoTai extends Application {
    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        Stage s1 = new Stage();
        s1.setTitle("s1");
        s1.show();


        Stage s2 = new Stage();
        s2.setTitle("s2");
        s2.initOwner(s1);
        //Modality.WINDOW_MODAL：  s2的owner
        s2.initModality(Modality.WINDOW_MODAL);
        s2.show();

//        Stage s3 = new Stage();
//        s3.setTitle("s3");
//        //Modality.APPLICATION_MODAL：  锁死所有的其他窗口，仅当前窗口可用（当前窗口关闭后，方可操作其他窗口）
//        s3.initModality(Modality.APPLICATION_MODAL);
//        s3.show();
    }
}